package day17.udp;

import lombok.SneakyThrows;

import java.net.*;

public class Client {
    @SneakyThrows
    public static void main(String[] args) {
        InetAddress inetAddress = InetAddress.getByName("127.0.0.1");
        SocketAddress address = new InetSocketAddress(inetAddress, 9527);
        // 写明要发送的服务器IP和PORT
        DatagramSocket datagramSocket = new DatagramSocket();
        byte[] data = "hi~server!你好!".getBytes();
        DatagramPacket packet = new DatagramPacket(data, data.length, address);
        datagramSocket.send(packet);
        System.out.println("aaa");
    }
}
